
/*
This file is part of MJIN2.

Copyright (C) 2012-2013 Opensource Game Studio

This software is provided 'as-is', without any express or implied
warranty.  In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgment in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#ifndef MJIN2_SOUND_SOURCE_H
#define MJIN2_SOUND_SOURCE_H

#include <mjin2/Exception.h>
#include <mjin2/SoundTypes.h>
#include <mjin2/TypeDefs.h>

namespace mjin2
{

//! Base class for Sound Source
class SoundSource
{
    public:
        SoundSource() throw (Exception);
        virtual ~SoundSource() throw ();

        virtual bool isEnabled() const throw ();
        virtual void setEnabled(bool enabled) throw (Exception);
        //! Has effect only before the source has been started.
        virtual void setLooping(bool state) throw (Exception) = 0;
        //! \exception "Invalid sound state"
        //! Only SOUND_SOURCE_STATE_PAUSED, SOUND_SOURCE_STATE_PLAYING, SOUND_SOURCE_STATE_STOPPED allowed.
        //! No effect when the source is disabled.
        virtual void setState(SOUND_SOURCE_STATE state) throw (Exception) = 0;
        virtual void setVolume(float value) throw (Exception);
        virtual SOUND_SOURCE_STATE state() const throw (Exception) = 0;
        virtual float volume() const throw (Exception);

    protected:
        u32 mID;
        bool mEnabled;
};

} // namespace mjin2

#endif // MJIN2_SOUND_SOURCE_H
